home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / utilit~1 / futilsrc.zoo / fileutil / reconfig < prev   
Encoding:
Text File  |  1991-10-20  |  2.3 KB  |  93 lines

  1. :
  2. trap 'rm -f conftest conftest.c uttest; exit 1' 1 3 15
  3.  
  4. set +u # Make sure unset variables are ok.
  5.  
  6. CC=gcc
  7. RANLIB=echo
  8. PROGS= 
  9. DEFS="-DSIGTYPE=int -DSTDC_HEADERS -DFCHMOD_MISSING -DFTIME_MISSING -DMKFIFO_MISSING -DFTRUNCATE_MISSING"
  10. LIBS=
  11. LIBPROGS=
  12. LIBOBJS="fnmatch.o stpcpy.o"
  13.  
  14. # A filename unique to this package, relative to the directory that
  15. # configure is in, which we can look for to find out if srcdir is correct.
  16. unique_file=src/ls.c
  17.  
  18. for arg in $*; do
  19.   # Handle +srcdir with a space before the argument.
  20.   if [ x$next_srcdir = xyes ]; then srcdir=$arg; next_srcdir=
  21.   # Handle +host with a space before the argument.
  22.   elif [ x$next_host = xyes ]; then next_host=
  23.   else 
  24.     case $arg in
  25.      -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
  26.     srcdir=`echo $arg | sed 's/[+-]s[a-z]*=//'` ;;
  27.      -srcdir | +srcdir | +srcdi | +srcd | +src | +sr | +s)
  28.     next_srcdir=yes ;;
  29.      -host=* | +host=* | +hos=* | +ho=* | +h=*) ;;
  30.      -host | +host | +hos | +ho | +h)
  31.     next_host=yes ;;
  32.      -gas | +gas | +ga | +g) ;;
  33.      -nfp | +nfp | +nf | +n) ;;
  34.      *) ;;
  35.     esac
  36.   fi
  37. done
  38.  
  39. vpsub='s@\$\([-./a-zA-Z0-9]*\)<@\1@g'
  40. # Find the source files, if location was not specified.
  41. if [ x$srcdir = x ]; then
  42.   srcdirdefaulted=yes; srcdir=.
  43.   if [ ! -r $unique_file ]; then srcdir=`pwd`/..; fi
  44. fi
  45. if [ $srcdir != . ]; then
  46.   VPATH='VPATH = $(srcdir)'
  47.   vpsub='s@\$\([-./a-zA-Z0-9]*\)<@\$<@g'
  48. fi
  49.  
  50. if [ ! -r $srcdir/$unique_file ]; then
  51.   if [ x$srcdirdefaulted = xyes ]; then
  52.     echo "$0: Can not find sources in \`.' or \`..'." 1>&2
  53.   else
  54.     echo "$0: Can not find sources in \`${srcdir}'." 1>&2
  55.   fi
  56.   exit 1
  57. fi
  58.  
  59. CC=${CC-cc}
  60. RANLIB=${RANLIB-echo}
  61. INCLUDEDIR=${INCLUDEDIR-/usr/include}
  62.  
  63. rm -f conftest conftest.c
  64. compile="$CC $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1"
  65.  
  66. case "$LIBOBJS" in
  67. *rename.o*)
  68.   LIBPROGS="$LIBPROGS mvdir"
  69.   DEFS="$DEFS -DMVDIR="'\\"$(libdir)/mvdir\\"'
  70.   ;;
  71. esac
  72.  
  73. trap 'rm -f Makefile lib/Makefile src/Makefile man/Makefile config.status; exit 1' 1 3 15
  74.  
  75. for dir in . lib src man
  76. do
  77.   test -d $dir || mkdir $dir
  78.   echo '# Generated automatically from Makefile.in by configure.' > $dir/Makefile
  79.   sed -e "
  80. $vpsub
  81. s,@srcdir@,$srcdir,
  82. s,@VPATH@,$VPATH,
  83. s,@CC@,$CC,
  84. s,@RANLIB@,$RANLIB,
  85. s,@PROGS@,$PROGS,
  86. s,@DEFS@,$DEFS,
  87. s,@LIBS@,$LIBS,
  88. s,@LIBPROGS@,$LIBPROGS,
  89. s,@LIBOBJS@,$LIBOBJS,
  90. " $srcdir/$dir/Makefile.in >> $dir/Makefile
  91. done
  92.  
  93.